# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.930.107.5 -> 1.930.107.6
#	include/asm-generic/tlb.h	1.2     -> 1.3    
#	arch/ia64/kernel/setup.c	1.9     -> 1.9.1.1
#	include/asm-ia64/processor.h	1.12.1.1 -> 1.12.1.2
#	include/asm-ia64/tlb.h	1.1     -> 1.2    
#	 arch/ia64/mm/init.c	1.7.1.3 -> 1.7.2.1
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/05/13	bjorn_helgaas@hp.com	1.930.112.24
# Merge hp.com:/home/helgaas/bk/linux-2.4
# into hp.com:/home/helgaas/bk/to-marcelo-2.4
# --------------------------------------------
# 03/05/13	kaos@sgi.com	1.930.112.25
# ia64: Hold modlist_lock while searching exception tables.
# 
# a64 is not taking the spinlock that closes the race between module
# removal and traversal of exception tables.  It can result in oops when
# one cpu takes an exception while another is unloading a module.
# 
# Other architectures take this lock.  The patch is almost a cut and
# paste from i386.
# --------------------------------------------
# 03/05/13	kaos@sgi.com	1.930.112.26
# ia64: Handle SAL rejection of MCA rendezvous timeout value.
# --------------------------------------------
# 03/05/13	bjorn_helgaas@hp.com	1.930.1.193
# Merge hp.com:/home/helgaas/bk/to-marcelo-2.4
# into hp.com:/home/helgaas/bk/linux-ia64-2.4
# --------------------------------------------
# 03/05/13	bjorn_helgaas@hp.com	1.930.1.194
# Merge hp.com:/home/helgaas/bk/ia64-extras
# into hp.com:/home/helgaas/bk/linux-ia64-2.4
# --------------------------------------------
# 03/05/14	paulus@samba.org	1.930.142.1
# Merge bk://ppc@ppc.bkbits.net/for-marcelo-ppc
# into samba.org:/home/paulus/kernel/for-marcelo-ppc
# --------------------------------------------
# 03/05/13	maxk@qualcomm.com	1.930.138.5
# [Bluetooth] L2CAP sockets can now set LM_RELIABLE flag and get notification 
# when we detect reliablity problem with the ACL connection.
# Bluetooth qualification tests requires this functionality.
# --------------------------------------------
# 03/05/14	gibbs@overdrive.btc.adaptec.com	1.930.128.5
# Aic7xxx and Aic79xx Driver Update
#  o Remove errno and unistd.h usage
#  o Remove splitting of S/G elements that cross
#    a 4GB boundary.  Code above the driver already
#    guatantees that this cannot happen.
#  o Simplify irqreturn_t compatibility glue.
#  o Fix GCC 3.3 warnings.
# --------------------------------------------
# 03/05/14	gibbs@overdrive.btc.adaptec.com	1.930.128.6
# Aic79XX Driver Update
#  o Fixup spelling of "coalesce" and derivatives.
# --------------------------------------------
# 03/05/14	gibbs@overdrive.btc.adaptec.com	1.930.128.7
# Aic7xxx Driver Update
#  o Fix a few twin channel target id calculation bugs
#    in the domain validation code.  These would only
#    effect the 2742T.
# --------------------------------------------
# 03/05/14	gibbs@overdrive.btc.adaptec.com	1.930.128.8
# Aic7xxx Driver README update
#  o Add a changelog entry for 6.2.34
# --------------------------------------------
# 03/05/14	gibbs@overdrive.btc.adaptec.com	1.930.128.9
# Aic79xx and Aic7xxx Driver Updates
#  o Add support for 2.5.X's scsi_report_device_reset.
#  o Use #ifdef insetad of #if for testing Kconfig values.
# --------------------------------------------
# 03/05/14	davem@nuts.ninka.net	1.930.130.29
# [RTNETLINK]: extern __inline__ --> static inline.
# --------------------------------------------
# 03/05/14	davem@nuts.ninka.net	1.930.130.30
# [TCP]: extern __inline__ --> static inline where appropriate.
# --------------------------------------------
# 03/05/14	davem@nuts.ninka.net	1.930.130.31
# [IPV6]: extern __inline__ --> static inline.
# --------------------------------------------
# 03/05/15	davem@nuts.ninka.net	1.930.130.32
# [SUNHME]: Use PCI config space if hm-rev property does not exist.
# --------------------------------------------
# 03/05/15	mort@wildopensource.com	1.930.107.6
# Move mmu_gathers[] to local_cpu_data on ia64.
# 
# This is a patch that moves mmu_gathers into local_cpu_data on IA64 NUMA.
# I'm not exactly sure where to push this patch, because it does touch
# include/asm-generic/tlb.h although it has no effect on non ia64 arches.
# 
# The main reason for making this change is that the mmu_gathers array
# gets very large as the number of processors increases.
# --------------------------------------------
#
diff -Nru a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
--- a/arch/ia64/kernel/setup.c	Wed Oct  8 09:09:49 2003
+++ b/arch/ia64/kernel/setup.c	Wed Oct  8 09:09:49 2003
@@ -40,6 +40,7 @@
 #include <asm/system.h>
 #include <asm/mca.h>
 #include <asm/smp.h>
+#include <asm/tlb.h>
 
 #ifdef CONFIG_BLK_DEV_RAM
 # include <linux/blk.h>
@@ -58,6 +59,7 @@
  struct cpuinfo_ia64 *boot_cpu_data;
 #else
  struct cpuinfo_ia64 _cpu_data[NR_CPUS] __attribute__ ((section ("__special_page_section")));
+ mmu_gather_t mmu_gathers[NR_CPUS];
 #endif
 
 unsigned long ia64_cycles_per_usec;
@@ -566,6 +568,8 @@
 		for (cpu = 1; cpu < NR_CPUS; ++cpu)
 			memcpy(my_cpu_data->cpu_data[cpu]->cpu_data,
 			       my_cpu_data->cpu_data, sizeof(my_cpu_data->cpu_data));
+		my_cpu_data->mmu_gathers = alloc_bootmem_pages_node(BOOT_NODE_DATA(boot_get_local_cnodeid()),
+								    sizeof(mmu_gather_t));
 	} else {
 		order = get_order(sizeof(struct cpuinfo_ia64));
 		my_cpu_data = page_address(alloc_pages_node(numa_node_id(), GFP_KERNEL, order));
@@ -575,9 +579,14 @@
 			     order);
 		for (cpu = 0; cpu < NR_CPUS; ++cpu)
 			boot_cpu_data->cpu_data[cpu]->cpu_data[smp_processor_id()] = my_cpu_data;
+
+		my_cpu_data->mmu_gathers = page_address(boot_alloc_pages_node(boot_get_local_cnodeid(),
+									      GFP_KERNEL,
+									      get_order(sizeof(mmu_gather_t)));
 	}
 #else
 	my_cpu_data = cpu_data(smp_processor_id());
+	my_cpu_data->mmu_gathers = &mmu_gathers[smp_processor_id()];
 #endif
 
 	/*
diff -Nru a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
--- a/arch/ia64/mm/init.c	Wed Oct  8 09:09:49 2003
+++ b/arch/ia64/mm/init.c	Wed Oct  8 09:09:49 2003
@@ -26,9 +26,6 @@
 #include <asm/sal.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
-#include <asm/tlb.h>
-
-mmu_gather_t mmu_gathers[NR_CPUS];
 
 /* References to section boundaries: */
 extern char _stext, _etext, _edata, __init_begin, __init_end;
diff -Nru a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
--- a/include/asm-generic/tlb.h	Wed Oct  8 09:09:49 2003
+++ b/include/asm-generic/tlb.h	Wed Oct  8 09:09:49 2003
@@ -31,15 +31,18 @@
 	pte_t	ptes[FREE_PTE_NR];
 } mmu_gather_t;
 
+#ifndef local_mmu_gathers
 /* Users of the generic TLB shootdown code must declare this storage space. */
 extern mmu_gather_t	mmu_gathers[NR_CPUS];
+#define local_mmu_gathers	&mmu_gathers[smp_processor_id()]
+#endif
 
 /* tlb_gather_mmu
  *	Return a pointer to an initialized mmu_gather_t.
  */
 static inline mmu_gather_t *tlb_gather_mmu(struct mm_struct *mm)
 {
-	mmu_gather_t *tlb = &mmu_gathers[smp_processor_id()];
+	mmu_gather_t *tlb = local_mmu_gathers;
 
 	tlb->mm = mm;
 	/* Use fast mode if there is only one user of this mm (this process) */
diff -Nru a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
--- a/include/asm-ia64/processor.h	Wed Oct  8 09:09:49 2003
+++ b/include/asm-ia64/processor.h	Wed Oct  8 09:09:49 2003
@@ -167,6 +167,7 @@
 	__u32 ptce_count[2];
 	__u32 ptce_stride[2];
 	struct task_struct *ksoftirqd;	/* kernel softirq daemon for this CPU */
+	void *mmu_gathers;
 # ifdef CONFIG_PERFMON
 	unsigned long pfm_syst_info;
 # endif
diff -Nru a/include/asm-ia64/tlb.h b/include/asm-ia64/tlb.h
--- a/include/asm-ia64/tlb.h	Wed Oct  8 09:09:49 2003
+++ b/include/asm-ia64/tlb.h	Wed Oct  8 09:09:49 2003
@@ -1 +1,3 @@
+#define local_mmu_gathers local_cpu_data->mmu_gathers
+
 #include <asm-generic/tlb.h>